import {
  legacy_createStore as createStore,
  combineReducers,
  applyMiddleware,
} from 'redux';
// 导入logger中间件
import logger from 'redux-logger';
// 导入redux-thunk中间件
import thunk from 'redux-thunk';
// 导入浏览器查看 redux 状态中间件
import { composeWithDevTools } from 'redux-devtools-extension';

// 导入 reducer
import { todos } from './reducers/todos';

// 合并多个 reducer
const rootReducer = combineReducers({ todos });

// 创建 store
export const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
);
